<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;

class PermissionInputDTO extends FormRequest
{
    public function authorize()
    {
        return true;
    }

    public function rules()
    {
        return [
            'name' => 'required|max:255',
            'display_name' => 'required|max:50',
            'guard_name' => 'required|max:200',
            'route' => 'max:50',
            'icon' => 'max:10',
            'parent_id' => 'integer',
            'sort' => 'numeric|max:99',
            'note' => 'max:500',

        ];
    }

    public function messages()
    {
        return [
            'name.required' => '菜单权限名称必须填写',
            'name.max' => '菜单权限名称不能超过255个字符',
            'display_name.max' => '菜单显示名称不能超过50个字符',
            'display_name.required' => '菜单显示名称必须填写',
            'guard_name.required' => '所属分组必须选择',
            'guard_name.max' => '分组参数错误',
            'route.max' => '路由地址不能超过50个字符',
            'icon.max' => '图标不能超过20个字符',
            'parent_id.integer' => '参数错误',
            'sort.integer' => '排序参数错误必须为数字',
            'sort.size' => '排序最大值为99',
            'note.max' => '备注信息不能超过500个字符',
        ];
    }
}
